<template>
	<view>
		<view class="upload">
			<view>图片上传</view>
			<button @click="doUpload">选择图片</button>
		</view>
		<view class="international">
			<view>{{i18n.international}}</view>
			<button @click="changeLanguage">{{i18n.btn}}</button>
		</view>
	</view>
</template>

<script>
	import Language from '@/utils/language/index.js'
	export default {
		data() {
			return {

			}
		},
		computed: {
			i18n() {
				console.log(this.$t('test'))
				return this.$t('test')
			}
		},
		methods: {
			//切换语言
			changeLanguage() {
				let curType = uni.getStorageSync('language_key') || 'ZH'
				let nextType = curType === 'ZH' ? 'EN':'ZH'
				uni.setStorageSync('language_key', nextType)
				Language.locale = nextType
				console.log(uni.getLocale())
			},
			//选择图片
			doUpload() {
				uni.chooseImage({
					count: 3,
					crop: {
						width: 300,
						height: 300
					},
					success: (res) => {
						console.log(res);
					}
				})
			}
		}
	}
</script>

<style>

</style>